package com.customer.crm.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.customer.crm.system.mapper.SystemFunctionMapper;
import com.customer.crm.system.pojo.Menu;
import com.customer.crm.system.pojo.SystemFunction;
import com.customer.crm.system.pojo.SystemRole;
import com.customer.crm.system.pojo.SystemUser;
import com.customer.crm.system.service.SystemFunctionService;
import com.customer.crm.system.service.SystemRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Lyp
 * @create 2021/12/16
 */
@Service
public class SystemFunctionServiceImpl extends ServiceImpl<SystemFunctionMapper, SystemFunction> implements SystemFunctionService {


    @Autowired
    SystemRoleService systemRoleService;

    @Override
    public List<Menu> allSystemUserFunctions(String username) {
        return baseMapper.allSystemUserFunctions(username);
    }

    @Override
    public List<SystemFunction> findByRoleId(String id) {
        List<SystemRole> roles = systemRoleService.findByUserId(id);
        return baseMapper.findByRoleId(roles);
    }

    @Override
    public List<SystemFunction> findByRoleIdCopy(String ids) {
        return baseMapper.findByRoleIdCopy(ids);
    }
}

